A r t i c l e s
Navigation

Note: This site is
a bit older, personal views
may have changed.

M a i n P a g e

D i r e c t o r y

Session vs Cookie


Difference between a cookie variable and a session variable:

Sessions

A session variable is used to keep track of user state, or user information/details applying to the current session or time period. Memory or files (or database) is used to keep track of the information for a specific period of time, i.e. 20 minutes, 2 days, etc.

Once that user has been dormant or inactive for over 20 minutes, the session is ended, and dropped from the memory. Then the user is logged out, along with any other expirations you wish to implement.

Cookies

On the other hand, cookie variables are stored for longer periods of time. Cookies can be used with sessions strategically, such as when you need to attach a user to a certain session.

About
This site is about programming and other things.
_ _ _